import React from "react";
import Dashboard from "./components/Dashboard";
import { ErrorBoundary } from "./components/ErrorBoundary";

export const App: React.FC = () => {
  return (
    <ErrorBoundary
      fallback={
        <div
          style={{
            minHeight: "100vh",
            display: "flex",
            alignItems: "center",
            justifyContent: "center",
            background: "#0f172a",
            color: "#e5e7eb",
            flexDirection: "column",
            gap: 16,
          }}
        >
          <h1 style={{ margin: 0, fontSize: 24 }}>应用加载错误</h1>
          <p style={{ color: "#9ca3af" }}>请刷新页面重试</p>
          <button
            onClick={() => window.location.reload()}
            style={{
              padding: "8px 16px",
              background: "#22c55e",
              color: "#020617",
              border: "none",
              borderRadius: "6px",
              cursor: "pointer",
              fontSize: 14,
            }}
          >
            刷新页面
          </button>
        </div>
      }
    >
      <Dashboard />
    </ErrorBoundary>
  );
};

